<?php
include_once ("../sql_connect.php");
include_once ("../msg_redirect.php");
?>
<?php
$w_id =$_POST[w_id];
$u_no = $_COOKIE['u_no'];

/*查询该微博是否被收藏*/
$my_sql = mysql_query("select * from collection where w_id='$w_id' and u_no='$u_no'",$connection); /*检查collection表中得最大id编号*/
$my_result = mysql_fetch_array($my_sql);
if (!$my_result){
	/*若未收藏，则写入数据库*/
	$my_sql = mysql_query("select MAX(collection_id) from collection",$connection); /*检查collection表中得最大id编号*/
	$my_result = mysql_fetch_array($my_sql);

	/*对将要输入weibo表的数据项量进行赋值*/
	$c_id = $my_result[0] + 1;
	$c_date = time();

	/*插入数据*/
	$my_sql = mysql_query("insert into collection values('$c_id','$u_no','$w_id','$c_date')",$connection);
	echo true;
}
else {
	echo false;
}
return;
?>